from datetime import datetime

# 毫秒数
milliseconds = 1733875200000
milliseconds1 = 1741583062000


# 将毫秒数转换为秒数
seconds = milliseconds / 1000

seconds1 = milliseconds1 / 1000

# 使用datetime.fromtimestamp()方法将秒数转换为日期
date = datetime.fromtimestamp(seconds)
date1 = datetime.fromtimestamp(seconds1)


print(date)
print(date1)


# 字符串日期
date_start = "2024-10-1 00:00:00"
date_end = "2024-10-05 23:27:00"

# 指定日期字符串的格式
date_format = "%Y-%m-%d %H:%M:%S"

# 使用strptime()方法将字符串日期转换为日期对象
date_start_d = datetime.strptime(date_start, date_format)
date_end_d = datetime.strptime(date_end, date_format)

#输出毫秒数
print(date_start_d.timestamp() * 1000)
print(date_end_d.timestamp() * 1000)